#include "RaffleActivity.h"

#include <iostream>
using namespace std;

CanRaffleState::CanRaffleState(RaffleActivity* activity)
{
    cout << "CanRaffleState::CanRaffleState(RaffleActivity* activity)" << endl;
    srand(time(nullptr));
    _activity = activity;
}

void CanRaffleState::DeductMoney()
{
    cout << "CanRaffleState::DeductMeney()" << endl;
}

bool CanRaffleState::Raffle()
{
    cout << "CanRaffleState::Raffle()" << endl;
    int result = rand() % 10;
    if (result == 0) {
        _activity->SetState(_activity->GetDispenseState());
        return true;
    } else {
        cout << "CanRaffleState::Raffle() : No" << endl;
        _activity->SetState(_activity->GetNoRaffleState());
        return false;
    }
}

void CanRaffleState::DispensePrize()
{
    cout << "CanRaffleState::DispensePrize()" << endl;
}